<template>
  <div class="main-wrap">
    好多商品啊
  </div>
</template>

<script>
  import {getCookie} from "../../assets/js/cookie";

  export default {
    name: "admin",
    mounted() {
      // 页面挂载获取保存的cookie值，渲染到页面上
      let uname = getCookie('username');
      console.log(uname);
      this.name = uname;
      // 如果cookie不存在或者不是admin，则跳转到登录页
      if (uname == '' || uname != 'admin') {
        this.$router.push('/');
      }
    }
  }
</script>

<style scoped lang="less">
  .main-wrap {
    width: 100%;
    margin: 0 auto;
    text-align: center;
    h3 {
      font-size: 0.3rem;
      line-height: 0.8rem;
      font-weight: normal;
    }
    ul {
      width: 5rem;
      height: auto;
      margin: 0 auto;
      li {
        font-size: 0.3rem;
        line-height: 0.5rem;
        text-align: center;
      }
    }
  }
</style>
